-
Notifications
You must be signed in to change notification settings - Fork 1
Improve Performance: CoPilot: users experience #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refactors the CoPilot chat agent to improve scalability and add streaming support. The main changes include:
- Refactoring global singletons to instance-based LLM sessions: Removes global
LLMSession()instances and passes them as parameters to avoid blocking in multi-user scenarios - Adding streaming support: Implements Server-Sent Events (SSE) streaming for real-time response delivery to the frontend
- Improving thread safety: Adds locks for authentication state and introduces per-instance stream callbacks
Reviewed Changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/copilot-chat/src/copilot_agent/utils/llmsession.py | Added streaming methods, per-instance callbacks, config caching, and thread safety improvements |
| src/copilot-chat/src/copilot_agent/utils/summary.py | Updated to accept llm_session parameter instead of using global instance |
| src/copilot-chat/src/copilot_agent/utils/smart_help.py | Refactored from function to class-based SmartHelp for better state management |
| src/copilot-chat/src/copilot_agent/ltp/ltp.py | Converted from module-level functions to LTP class with instance-based session handling |
| src/copilot-chat/src/copilot_agent/copilot_service.py | Added streaming endpoint and session management per user/conversation |
| src/copilot-chat/src/copilot_agent/copilot_conversation.py | Updated to use per-conversation LLM sessions |
| src/copilot-chat/src/copilot_agent/utils/push_frontend.py | New module for pushing events to frontend via streaming |
| contrib/copilot-plugin/src/app/ChatBox.tsx | Frontend updated to consume SSE streaming responses |
| contrib/copilot-plugin/src/app/ChatHistory.tsx | Enhanced auto-scroll behavior for streaming updates |
Files not reviewed (1)
- contrib/copilot-plugin/package-lock.json: Language not supported
Comments suppressed due to low confidence (3)
src/copilot-chat/src/copilot_agent/copilot_conversation.py:205
- This comment appears to contain commented-out code.
# try:
# push_frontend_meta(response_message_info)
# except Exception:
# logger.debug('Failed to push early meta event for streaming client')
src/copilot-chat/src/copilot_agent/utils/dcw.py:123
- Call to function gen_dcw with too few arguments; should be no fewer than 3.
full_dcw = gen_dcw(user_prompt, map_existing)
src/copilot-chat/src/copilot_agent/copilot_turn.py:56
- This statement is unreachable.
question = this_inquiry
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…approach to detect incremental updates.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…extract_session_info(data).
…on to make sure each thread uses its session
d52405d to
558637e
Compare
hippogr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a single comment, which is minor for you to review and resolve it. Besides of that, I guess we are good to go. ✌️
This PR is mainly about improving the user experience.
Effectiveness of this PR: